// ***********************************************************************
// Assembly         : GeYiHome.Domain
// Author           : Mr.Fucker
// Created          : 03-17-2017
//
// Last Modified By : Mr.Fucker
// Last Modified On : 03-17-2017
// ***********************************************************************
// <copyright file="EntityBaseTypeConfiguration.cs" company="">
//     Copyright ©  2017
// </copyright>
// <summary></summary>
// ***********************************************************************

using System.Data.Entity.ModelConfiguration;
using GeYiHome.Domain.Entities;

namespace GeYiHome.Db.DbMapping
{
    /// <summary>
    /// Class EntityBaseTypeConfiguration.
    /// </summary>
    /// <typeparam name="TEntity">The type of the t entity.</typeparam>
    /// <seealso cref="System.Data.Entity.ModelConfiguration.EntityTypeConfiguration{TEntity}" />
    public class EntityBaseTypeConfiguration<TEntity> : EntityTypeConfiguration<TEntity>
        where TEntity : BaseEntity
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="EntityBaseTypeConfiguration{TEntity}"/> class.
        /// </summary>
        protected EntityBaseTypeConfiguration()
        {
            Property(x => x.Id).HasColumnName("id").IsRequired();
            Property(x => x.AddTime).HasColumnName("add_time");
            Property(x => x.AddUserId).HasColumnName("add_user_id");
            Property(x => x.AddUserName).HasColumnName("add_user_name").HasMaxLength(100);
            Property(x => x.ModifyTime).HasColumnName("modify_time").IsOptional();
            Property(x => x.ModifyUserId).HasColumnName("modify_user_id").IsOptional();
            Property(x => x.ModifyUserName).HasColumnName("modify_user_name").HasMaxLength(100).IsOptional();
            Property(x => x.DataState).HasColumnName("data_state");
        }
    }
}
